﻿#ifndef GLOBALVAR_H
#define GLOBALVAR_H
#include "Head.h"
#include <QObject>
#include <QVariant>
#include <QDateTime>
#include <QSettings>

struct MeasureParam
{
    MeasureParam()
    {
        SampleTimes=100;
        SampleIntervalMs=10;
        SaveDir="./";
        SampleMode="采集数据";
        IsRemoveBaseline=false;
        IsRemoveBlankLine=false;
    }

    int SampleTimes;
    int SampleIntervalMs;
    QString SaveDir;
    QString SampleMode;
    bool IsRemoveBaseline;
    bool IsRemoveBlankLine;
};

struct ValidPw
{
    ValidPw()
    {
        Password="12345";
    }

    QString Password;
};


class GlobalVar
{
private:
    GlobalVar();
    GlobalVar(const GlobalVar&)=delete;
    GlobalVar& operator=(const GlobalVar&)=delete;

public:
    static GlobalVar& Instance();

    MeasureParam GetMeasureParam();
    void SetMeasureParam(MeasureParam param);

    ValidPw GetPw();
    void SetPw(ValidPw param);

    void SetPlotConfig(bool lockAxis, double upper);
    void GetPlotConfig(bool &lockAxis, double &upper);

    QSettings* Setting;
};

#endif // GLOBALVAR_H
